package com.yingxin.yx.framework.commons.activiti;

import java.util.HashMap;
import java.util.Map;

public class ApprovalStatusHelper {

    private static final Map<String, ApprovalStatus> map = new HashMap<>();

    public static void init() {
        if (map.size() == 0) {
            for (ApprovalStatus status : ApprovalStatus.values()) {
                map.put(status.getStatus(), status);
            }
        }
    }

    public static String getName(String id) {
        init();
        ApprovalStatus status = map.get(id);
        if (status != null) {
            return status.getStatusName();
        }
        return null;
    }


    public static ApprovalStatus get(String id) {
        init();
        return map.get(id);
    }

}
